package com.zhuhjay.service.system.model.dto;

import com.zhuhjay.common.security.context.LoginUserContext;
import com.zhuhjay.common.web.annotation.Matching;
import com.zhuhjay.common.web.enums.MatchingMode;
import com.zhuhjay.service.system.model.entity.SystemNotice;
import lombok.Data;

/**
 * @author ZhuHJay
 * @date 2023/4/13 14:29
 */
@Data
public class NoticeDto {

    @Matching(MatchingMode.NoticeTitle)
    private String title;
    @Matching(MatchingMode.NoticeContent)
    private String content;

    public SystemNotice toEntity() {
        SystemNotice notice = new SystemNotice();
        notice.setTitle(title);
        notice.setContent(content);
        notice.setUserId(LoginUserContext.getUserId());
        return notice;
    }

}
